package rlm.constraints;

import alm.LayoutSpec;
import linearProgramming.Variable;

public enum Directions {
	Left, Top, Right, Bottom;

	public Variable getOuterTab(LayoutSpec ls) {
		switch (this){
			case Left: return ls.getLeft();
			case Right: return ls.getRight();
			case Top: return ls.getTop();
			case Bottom: return ls.getBottom();
			default: return null;
		}
	}

	public Variable newTab(LayoutSpec ls) {
		if (this == Left || this == Right)
			return ls.addXTab();
		else
			return ls.addYTab();
	}

	public Directions getOtherDirection() {
		switch (this) {
		case Left:
			return Directions.Right;
		case Right:
			return Directions.Left;
		case Top:
			return Directions.Bottom;
		case Bottom:
			return Directions.Top;
		default : return null;
		}
	}
}
